<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>田千里</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="root">
    <h2>今天天气很{{info}}</h2>
<!--    <button @click="isHost=!isHost">切换天气</button>-->
    <button @click="changeWeather">切换天气</button>
</div>
</body>
<script type="text/javascript">
    Vue.config.productionTip=false
    const vm = new Vue({
        el:'#root',
        data:{
            isHost:true,
        },
        computed:{
            info(){
                return this.isHost?'炎热':'凉爽'
            }
        },
        methods:{
            changeWeather(){
                this.isHost=!this.isHost
            }
        },
    })
</script>
</html>